#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: MK2[fengmk2@gmail.com]
"""安全模块
"""

import base64

from contact.common import json


def decode(encode_s, key):
    """所有加密编码的字符串原始类型都是JSON格式的"""
    decode_s = base64.b64decode(encode_s)
    return json.loads(decode_s)

def encode(data, key):
    s = json.dumps(data)
    return base64.b64encode(s)
